/**
 * Urban Parks 
 *
 * Team M&M'S 
 * Michael Pogson
 * Michael Satran Jr.
 * Stehpen Hunter
 * 
 * Date: ${date}
 */
package model;

/**
 * @author Stephen Hunter, Michael Satran Jr
 * @version Winter 2012
 */
public class Volunteer extends User {
	
	/**
	 * True if user is currently black-balled, false otherwise.
	 */
	private boolean my_isBlackBalled;
	

	/*
	 * @pre the_firstName != null
	 * @pre the_lastName != null
	 * @pre the_phoneNumber != null
	 * @pre the_email != null
	 * 
	 * @post my_firstName == the_firstName
	 * @post my_lastName == the_lastName
	 * @post my_phoneNumber == the_phoneNumber
	 * @post my_email == the_email
	 * @post my_blackball == the_blackball
	 */
	/**
	 * Constructor creates a volunteer object with the given values.
	 * 
	 * @param the_firstName The name to set as the volunteer's first name
	 * @param the_lastName The name to set as the volunteer's last name
	 * @param the_phoneNumber The String to set as the volunteer's phone number
	 * @param the_email The email to set as the volunteer's email
	 * @param the_blackball To be set as the blackball status of the volunteer
	 */
	public Volunteer(final String the_firstName, final String the_lastName,
					final String the_phoneNumber, final String the_email, final boolean the_blackball) {
		super(the_firstName, the_lastName, the_phoneNumber, the_email);
		my_isBlackBalled = the_blackball;
	}
	
	/*
	 * @post lackballs the volunteer
	 */
	/**
	 * Makes the volunteer blackballed.
	 */
	public void blackBall() {
		my_isBlackBalled = true;
	}
	
	/*
	 * @post Un-blackballs the volunteer
	 */
	/**
	 * Makes the volunteer no longer blackballed.
	 */
	public void unBlackBall() {
		my_isBlackBalled = false;
	}
	
	/*
	 * @post Returns true if the volunteer is blackballed, false otherwise
	 */
	/**
	 * Returns true if the volunteer is blackballed, fasle otherwise.
	 * 
	 * @return True if the volunteer is blackballed, false otherwise
	 */
	public boolean isBlackBalled() {
		return my_isBlackBalled;
	}
	
	/*
	 * @pre the_volunter != null
	 * 
	 * @post Will return true if the volunteer objects are equal, false otherwise
	 */
	/**
	 * Determines is the volunteers are equals based on their e-mail addresses.  Returns
	 *  true if they are equal, false otherwise.
	 *  
	 *  @param the_volunteer The object being tested for equality
	 *  @return True if the volunteers are equals, false otherwise
	 *  @throws IllegalArgumentException If the parameter is null
	 */
	public boolean equals(final Object the_volunteer) throws IllegalArgumentException {
		boolean result;
		if (the_volunteer == null) {
			throw new IllegalArgumentException("Volunteer is invalid/null.");
		} else {
			if(getEmail().equals(((Volunteer)the_volunteer).getEmail())) {
				result = true;
			} else {
				result = false;
			}
		}
		return result;
	}
	
	/*
	 * @post Returns a String representation of the user
	 */
	/**
	 * Returns a String representation of the volunteer.
	 * 
	 * @return A String representation of the volunteer.
	 * 			first last email phone
	 */
	public String toString() {
		
		return getFirstName() + " " + getLastName() + " - "+ getEmail() + " - " + getPhoneNumber();
	}
	
}
